feat(sdk-core): add webauthnInfo support to createMpc#8607
feat(sdk-core): add webauthnInfo support to createMpc#8607mohammadalfaiyazbitgo wants to merge 1 commit intomasterfrom
Conversation
e9c8790 to
0636e4f
Compare
| { | ||
| otpDeviceId: webauthnInfo.otpDeviceId, | ||
| prfSalt: webauthnInfo.prfSalt, | ||
| encryptedPrv: this.bitgo.encrypt({ |
There was a problem hiding this comment.
can use await this.bitgo.encryptAsync() instead of this.bitgo.encrypt() for the webauthn entry. it handles both v1/v2 based on encryptionVersion
| { | ||
| otpDeviceId: webauthnInfo.otpDeviceId, | ||
| prfSalt: webauthnInfo.prfSalt, | ||
| encryptedPrv: this.bitgo.encrypt({ |
There was a problem hiding this comment.
same, can use this.bitgo.encryptAsync()
| { | ||
| otpDeviceId: webauthnInfo.otpDeviceId, | ||
| prfSalt: webauthnInfo.prfSalt, | ||
| encryptedPrv: this.bitgo.encrypt({ |
| { | ||
| otpDeviceId: webauthnInfo.otpDeviceId, | ||
| prfSalt: webauthnInfo.prfSalt, | ||
| encryptedPrv: this.bitgo.encrypt({ |
| passphrase, | ||
| enterprise, | ||
| originalPasscodeEncryptionCode, | ||
| webauthnInfo: webauthnInfo ?? undefined, |
There was a problem hiding this comment.
webauthnInfo ?? undefined is a noop, just use webauthnInf
| }), | ||
| originalPasscodeEncryptionCode, | ||
| webauthnDevices: | ||
| webauthnInfo && recipientIndex === 1 |
There was a problem hiding this comment.
nit: use MPCv2PartiesEnum.USER instead of 1
There was a problem hiding this comment.
Good catch on using a named constant. wouldn't work here though — this is the non-MPCv2 ECDSA path which uses 1-based indexing (1 = user, 2 = backup, 3 = bitgo). Used ShareKeyPosition.USER (= 1) from ../../../tss/types instead, which is the correct named constant for this code path.
0636e4f to
dd33d5b
Compare
What changed: - Thread webauthnInfo through createMpc/createKeychains so hardware authenticator (PRF-derived) encryption can be stored alongside the standard encryptedPrv on user keychains - Use encryptAsync instead of encrypt for webauthnDevices entries so v2 encryption is applied consistently - Replace ad-hoc literal 1 with ShareKeyPosition.USER in ecdsa.ts webauthn guard - Remove AddKeychainOptions annotation that was inadvertently excluding prv from the type - Rename WebAuthn passphrase param type to WebauthnKeyEncryptionInfo, move canonical definition to iWallets.ts, consolidate duplicate AcceptShareWebauthnInfo, and re-export from iKeychains.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dd33d5b to
14aeaae
Compare
** Summary
MpcWebauthnInfointerface ({ otpDeviceId, prfSalt, passphrase }) iniKeychains.tsfor passing a PRF-derived passphrase into MPC key creationwebauthnInfo?: MpcWebauthnInfotoCreateMpcOptionsand threads it through all fourcreateKeychainsimplementations (EDDSA, EdDSA MPCv2, ECDSA, ECDSA MPCv2)webauthnDevicesentry on the user keychain encrypted with the PRF-derived passphrasewebauthnInfofromGenerateWalletOptionsthroughgenerateMpcWallet→createMpcfor the TSS wallet creation pathwebauthnInfois correctly forwarded to the underlyingcreateKeychainsfor both EDDSA and ECDSA TSSTest plan
yarn run unit-test --scope bitgoand verify new "should pass webauthnInfo to createKeychains" tests passcreateParticipantKeychaintests in ecdsaMPCv2 and ecdsa still passCloses WAL-761
🤖 Generated with Claude Code